import {defineStore, storeToRefs} from "pinia";
import {getUiTestCatTreeApi} from "@/api/modules/ui/uitest.js";
import {useProjectStore} from "@/stores/modules/project/project.js";
import {ElMessage} from "element-plus";
import {useWebSocket} from '@vueuse/core'
import {getGuidApi} from "@/api/modules/system/common.js";

const projectStore = useProjectStore()

const {currentProject, currentProjectId} = storeToRefs(projectStore)

export const useUiTestStore = defineStore({
    id: "chestnut-uitest",
    state: () => ({
        // 接口分类的树
        uiTestCatTree: [],
        // 当前选中的分类名
        selectedUiTestCatName: "",
        // 当前选中的分类ID
        selectedUiTestCatId: "",
        uiTestList: [],
    }),
    actions:{
        // 获取模块的树
        async getUiTestCatTree() {
            await getUiTestCatTreeApi({projectId: currentProjectId.value}).then(res => {
                this.uiTestCatTree = res.data
            })
        },
    }
})
